<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>统一地图平台</title><link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <style>
        html,
        body,
        #mapui {
            margin: 0 auto;
            width: 100%;
            height: 100%
        }

        html,
        body {
            margin: 0;
            overflow: hidden;
            background: #fff;
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
        }
    </style>

</head>

<body>
    <div id="mapui"></div>
    <script src="./js_thematic_map_example/script/jq/jquery.min.js"></script>
    <script src="./js_example/script/map.min.js"></script>
    <script src="./js_example/script/demo.js"></script>
    
    <script>
        var CHUNK_COUNT = 19;
        var resources = {
            "text_echartsLinesMillions_bjRoads": "北京道路网络图",
            "text_echartsLinesMillions_bjRoads_subtext": "130万点数据绘制",
        };
        var echartsLayer = null;
        var option = null;
        var amap = null;
        var that = this;

        var uploadedDataURL = "./js_thematic_map_example/data/changchunBus.json";

        $.get(uploadedDataURL, function (data) {

            var lines = [].concat.apply([], data.map(function (busLine) {
                busLine.lineStyle.normal.color = "#000";
                busLine.effect = {
                    constantSpeed: 60,
                    show: true,
                    trailLength: 0,
                    symbolSize: 30,
                    symbol: function () {
                        if ((Math.round(Math.random() * 2) % 2)) {
                            return 'image://./js_thematic_map_example/images/blueCar.png'
                        } else {
                            return 'image://./js_thematic_map_example/images/redCar.png'
                        }
                    }()
                };
                return busLine;
            }));

            option = {
                animation: false,
                GLMap: {
                    roam: true
                },
                coordinateSystem: 'GLMap',
                geo: {
                    map: 'GLMap',
                },

                series: [{
                    type: 'lines',
                    polyline: true,
                    data: lines,
                    silent: true,
                    lineStyle: {
                        normal: {
                            opacity: 1,
                            width: 2
                        }
                    },
                    progressiveThreshold: 500,
                    progressive: 100,
                }, {

                    type: 'lines',
                    coordinateSystem: 'GLMap',
                    polyline: true,
                    data: lines,
                    lineStyle: {
                        normal: {
                            width: 0.2
                        }
                    },
                    effect: {
                        constantSpeed: 60,
                        show: true,
                        trailLength: 0,
                        symbolSize: 30,
                    },
                }]
            };

            map.Factory.create('mapui', {
                style: style,
                center: [125.33, 43.89],
                fullExtent: {
                    xmin: 90.992204,
                    ymin: 10.979711,
                    xmax: 120.5338915,
                    ymax: 50.543712
                },
                zoom: 13,
                projection: 'EPSG:4326',
                strategy: ['mapboxgl', 'openlayers']
            }, (o) => {
                amap = o;
                map.Factory.loadSpecialMap('echarts', () => {
                that.init(amap.pmap);
            })
            });
        });



        function init(map) {
            echartsLayer = new EchartsLayer(map);
            echartsLayer.chart.setOption(option);
        }


    </script>
</body>

</html>